package com.liang.beikebusinesshandler.core.domain;

import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 源数据
 *
 * @author liangyehao
 * @version 1.0
 * @date 2021/4/24 0:19
 * @content
 */
@Data
public class BusinessData {


    @ExcelProperty("商机日期")
    private String businessDate;
    @ExcelProperty("品牌编码")
    private String brandCode;
    @ExcelProperty("品牌")
    private String brand;
    @ExcelProperty("城市名称")
    private String cityName;
    @ExcelProperty("城市编码")
    private String cityCode;
    @ExcelProperty("分公司编码")
    private String branchCode;
    @ExcelProperty("分公司")
    private String branch;
    @ExcelProperty("运营管理大区编码")
    private String operationsManagementDistrictCode;
    @ExcelProperty("运营管理大区")
    private String operationsManagementDistrict;
    @ExcelProperty("管理大区编码")
    private String managementOfRegionalCoding;
    @ExcelProperty("管理大区")
    private String managementDistrict;
    @ExcelProperty("大区")
    private String regional;
    @ExcelProperty("门店编码")
    private String storeCode;
    @ExcelProperty("门店")
    private String stores;
    @ExcelProperty("店组编码")
    private String storeGroupCoding;
    @ExcelProperty("店组名称")
    private String storeGroupName;
    @ExcelProperty("经纪人系统号")
    private String agentSystem;
    @ExcelProperty("经纪人姓名")
    private String agentName;
    @ExcelProperty("经纪人职务")
    private String agentOffice;
    @ExcelProperty("经纪人职级")
    private String brokerRank;
    @ExcelProperty("负责CA系统号")
    private String caSystemNo;
    @ExcelProperty("负责CA姓名")
    private String caName;
    @ExcelProperty("商机id")
    private String businessOpportunitiesId;
    @ExcelProperty("商机用户id")
    private String businessUsersId;
    @ExcelProperty("网站")
    private String webSite;
    @ExcelProperty("访问端")
    private String accessEnd;
    @ExcelProperty("商机类型")
    private String businessType;
    @ExcelProperty("业务类型")
    private String businessTypes;
    @ExcelProperty("是否录入房源")
    private String whetherInputHousing;
    @ExcelProperty("房源id")
    private String housingId;
    @ExcelProperty("录客情况")
    private String recordGuestIs;
    @ExcelProperty("客源录入时间")
    private String touristsEntryTime;
    @ExcelProperty("客源编码")
    private String sourceCode;
    @ExcelProperty("转客周期")
    private String turnGuestCycle;
    @ExcelProperty("首次带看id")
    private String forFirstTimeWithId;
    @ExcelProperty("首次带看时间")
    private String takeTimeForFirstTime;
    @ExcelProperty("转带看周期")
    private String turnWithPeriod;
    @ExcelProperty("协议编号")
    private String contractNumber;
    @ExcelProperty("协议时间")
    private String agreementTime;
    @ExcelProperty("转成交周期")
    private String turnToClinchADealCycle;
    @ExcelProperty("日期分区")
    private String dateOfPartition;
    @ExcelProperty("战区编码")
    private String theaterCoding;
    @ExcelProperty("战区名称")
    private String nameOfWarZone;
    @ExcelProperty("省区编码")
    private String provincesCoding;
    @ExcelProperty("省区名称")
    private String nameOfProvincesAndAutonomousRegions;
    @ExcelProperty("带看量")
    private String quantity;
    @ExcelProperty("带看房源量")
    private String takeLookAtHouses;
    @ExcelProperty("是否被其他人录入")
    private String whetherOthersInput;
    @ExcelProperty("客户前3尾4的手机号")
    private String f3e4MobilePhoneNo;
    @ExcelProperty("委托后首次带看时间")
    private String entrustedBeltToSeeForFirstTimeAfterTime;
    @ExcelProperty("是否他人带看")
    private String whetherOtherPeopleSee;
    @ExcelProperty("是否他人成交")
    private String whetherOthersClinchADeal;
    @ExcelProperty("商机发起人是否为内部员工")
    private String whetherBusinessSponsorsForInternalStaff;
    @ExcelProperty("是否封禁用户")
    private String whetherToBanUsers;
    @ExcelProperty("商机发生时间")
    private Date businessTime;
    @ExcelProperty("小区ID")
    private String communityId;
    @ExcelProperty("展位名称")
    private String nameOfBooth;
    @ExcelProperty("展位类型")
    private String boothType;



    @Override
    public int hashCode() {
        int result = businessOpportunitiesId.hashCode();
        result = 17 * result + businessType.hashCode();
        result = 17 * result + businessTypes.hashCode();
        return result;
    }


    @Override
    public boolean equals(Object obj) {
        if(!(obj instanceof BusinessData)) {
            // instanceof 已经处理了obj = null的情况
            return false;
        }
        BusinessData businessData = (BusinessData) obj;
        // 地址相等
        if (this == businessData) {
            return true;
        }
        // 如果两个对象businessOpportunitiesId businessType businessTypes相等，我们认为两个对象相等
        return businessData.businessOpportunitiesId.equals(this.businessOpportunitiesId)
                && businessData.businessType.equals(this.businessType)
                && businessData.businessTypes.equals(this.businessTypes);
    }

    public static void main(String[] args) {
        BusinessData d1 = new BusinessData();
        d1.setBusinessOpportunitiesId("1");
        d1.setBusinessType("2");
        d1.setBusinessTypes("3");
        d1.setAccessEnd("111111111111");

        BusinessData d2 = new BusinessData();
        d2.setBusinessOpportunitiesId("1");
        d2.setBusinessType("2");
        d2.setBusinessTypes("3");
        d2.setAccessEnd("22222222");

        BusinessData d3 = new BusinessData();
        d3.setBusinessOpportunitiesId("1");
        d3.setBusinessType("2");
        d3.setBusinessTypes("3");
        d3.setAccessEnd("333333");

        System.out.println(d1 == d2);
        System.out.println(d1.equals(d2));
        System.out.println(d1.equals(d3));

        List<BusinessData> list = Arrays.asList(d1,d2,d3);

        List<BusinessData> collect = list.stream().distinct().collect(Collectors.toList());

        System.out.println(collect);

    }

}
